add models for Project, Task, Note, Category

This commit is contained in:
2025-06-11 19:56:30 +02:00
parent 2a458f74d6
commit 9906b291f1
29 changed files with 345 additions and 1 deletions

View File

@@ -0,0 +1,11 @@
class CreateProjectCategories < ActiveRecord::Migration[8.0]
def change
create_table :project_categories do |t|
t.string :title
t.text :description
t.integer :order
t.timestamps
end
end
end

View File

@@ -0,0 +1,13 @@
class CreateContacts < ActiveRecord::Migration[8.0]
def change
create_table :contacts do |t|
t.string :name
t.string :email
t.string :address
t.float :geo_long
t.float :geo_lat
t.timestamps
end
end
end

View File

@@ -0,0 +1,11 @@
class CreatePhoneNumbers < ActiveRecord::Migration[8.0]
def change
create_table :phone_numbers do |t|
t.string :phone_number
t.integer :type
t.references :contact, null: false, foreign_key: true
t.timestamps
end
end
end

View File

@@ -0,0 +1,14 @@
class CreateProjects < ActiveRecord::Migration[8.0]
def change
create_table :projects do |t|
t.string :title
t.string :website
t.string :email
t.integer :business_type
t.references :user, null: false, foreign_key: true
t.references :project_category, null: false, foreign_key: true
t.timestamps
end
end
end

View File

@@ -0,0 +1,15 @@
class CreateTasks < ActiveRecord::Migration[8.0]
def change
create_table :tasks do |t|
t.string :title
t.text :description
t.integer :priority
t.integer :status
t.integer :type
t.date :due_date
t.references :user, null: false, foreign_key: true
t.timestamps
end
end
end

View File

@@ -0,0 +1,13 @@
class CreateNotes < ActiveRecord::Migration[8.0]
def change
create_table :notes do |t|
t.string :title
t.text :description
t.boolean :pinned
t.boolean :archived
t.references :project, null: false, foreign_key: true
t.timestamps
end
end
end

88
db/schema.rb generated
View File

@@ -10,9 +10,74 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_06_11_155737) do
ActiveRecord::Schema[8.0].define(version: 2025_06_11_174428) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
enable_extension "pgcrypto"
create_table "contacts", force: :cascade do |t|
t.string "name"
t.string "email"
t.string "address"
t.float "geo_long"
t.float "geo_lat"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "notes", force: :cascade do |t|
t.string "title"
t.text "description"
t.boolean "pinned"
t.boolean "archived"
t.bigint "project_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_notes_on_project_id"
end
create_table "organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.string "name"
t.string "subdomain"
t.string "email_domain"
t.string "logo_url"
t.string "address"
t.string "website"
t.string "phone_number"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["subdomain"], name: "index_organizations_on_subdomain", unique: true
end
create_table "phone_numbers", force: :cascade do |t|
t.string "phone_number"
t.integer "type"
t.bigint "contact_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["contact_id"], name: "index_phone_numbers_on_contact_id"
end
create_table "project_categories", force: :cascade do |t|
t.string "title"
t.text "description"
t.integer "order"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "projects", force: :cascade do |t|
t.string "title"
t.string "website"
t.string "email"
t.integer "business_type"
t.bigint "user_id", null: false
t.bigint "project_category_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["project_category_id"], name: "index_projects_on_project_category_id"
t.index ["user_id"], name: "index_projects_on_user_id"
end
create_table "sessions", force: :cascade do |t|
t.bigint "user_id", null: false
@@ -23,13 +88,34 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_11_155737) do
t.index ["user_id"], name: "index_sessions_on_user_id"
end
create_table "tasks", force: :cascade do |t|
t.string "title"
t.text "description"
t.integer "priority"
t.integer "status"
t.integer "type"
t.date "due_date"
t.bigint "user_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id"], name: "index_tasks_on_user_id"
end
create_table "users", force: :cascade do |t|
t.string "email_address", null: false
t.string "password_digest", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.uuid "organization_id", null: false
t.index ["email_address"], name: "index_users_on_email_address", unique: true
t.index ["organization_id"], name: "index_users_on_organization_id"
end
add_foreign_key "notes", "projects"
add_foreign_key "phone_numbers", "contacts"
add_foreign_key "projects", "project_categories"
add_foreign_key "projects", "users"
add_foreign_key "sessions", "users"
add_foreign_key "tasks", "users"
add_foreign_key "users", "organizations"
end