Добавление миграций БД и моделей

This commit is contained in:
Dmitry
2026-03-12 11:30:22 +03:00
parent e55ecb7d29
commit c016d6a319
11 changed files with 148 additions and 1 deletions
@@ -0,0 +1,18 @@
class CreateOrganizations < ActiveRecord::Migration[7.1]
def change
create_table :organizations do |t|
t.string :inn, null: false
t.string :full_name
t.string :kpp
t.string :okpo
t.string :okfs
t.string :okopf
t.string :okved2
t.string :address
t.timestamps
end
add_index :organizations, :inn
end
end
@@ -0,0 +1,13 @@
class CreateAuditors < ActiveRecord::Migration[7.1]
def change
create_table :auditors do |t|
t.string :name
t.string :inn
t.string :ogrn
t.timestamps
end
add_index :auditors, :inn
end
end
@@ -0,0 +1,9 @@
class CreateDocumentTypes < ActiveRecord::Migration[7.1]
def change
create_table :document_types do |t|
t.string :name, null: false
t.timestamps
end
end
end
@@ -0,0 +1,11 @@
class CreateYearlyFiles < ActiveRecord::Migration[7.1]
def change
create_table :yearly_files do |t|
t.references :organization, null: false, foreign_key: true
t.integer :year, null: false
t.references :auditor, foreign_key: true
t.timestamps
end
end
end
@@ -0,0 +1,12 @@
class CreateFinancialStatements < ActiveRecord::Migration[7.1]
def change
create_table :financial_statements do |t|
t.references :yearly_file, null: false, foreign_key: true
t.references :document_type, null: false, foreign_key: true
t.integer :sheet_number
t.jsonb :data, default: {}
t.timestamps
end
end
end