add entry requests, invite new users
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class AddStatusToEntries < ActiveRecord::Migration[8.1]
|
||||
def change
|
||||
add_column :entries, :status, :integer, default: 2, null: false
|
||||
add_index :entries, :status
|
||||
|
||||
# Set all existing entries to status: 2 (active)
|
||||
reversible do |dir|
|
||||
dir.up do
|
||||
execute "UPDATE entries SET status = 2"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class AddRequestedByToEntries < ActiveRecord::Migration[8.1]
|
||||
def change
|
||||
add_column :entries, :requested_by_id, :integer
|
||||
add_foreign_key :entries, :users, column: :requested_by_id
|
||||
add_index :entries, :requested_by_id
|
||||
end
|
||||
end
|
||||
+17
-30
@@ -1,15 +1,5 @@
|
||||
CREATE TABLE IF NOT EXISTS "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY);
|
||||
CREATE TABLE IF NOT EXISTS "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "entries" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category" integer DEFAULT 0 NOT NULL, "fi" varchar, "en" varchar, "sv" varchar, "no" varchar, "ru" varchar, "de" varchar, "notes" text, "verified" boolean DEFAULT FALSE NOT NULL, "created_by_id" integer, "updated_by_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, CONSTRAINT "fk_rails_367d1ab731"
|
||||
FOREIGN KEY ("created_by_id")
|
||||
REFERENCES "users" ("id")
|
||||
, CONSTRAINT "fk_rails_6f84c41258"
|
||||
FOREIGN KEY ("updated_by_id")
|
||||
REFERENCES "users" ("id")
|
||||
);
|
||||
CREATE INDEX "index_entries_on_created_by_id" ON "entries" ("created_by_id") /*application='SanastoWiki'*/;
|
||||
CREATE INDEX "index_entries_on_updated_by_id" ON "entries" ("updated_by_id") /*application='SanastoWiki'*/;
|
||||
CREATE INDEX "index_entries_on_category" ON "entries" ("category") /*application='SanastoWiki'*/;
|
||||
CREATE TABLE IF NOT EXISTS "comments" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer NOT NULL, "commentable_type" varchar NOT NULL, "commentable_id" integer NOT NULL, "body" text NOT NULL, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "language_code" varchar /*application='SanastoWiki'*/, CONSTRAINT "fk_rails_03de2dc08c"
|
||||
FOREIGN KEY ("user_id")
|
||||
REFERENCES "users" ("id")
|
||||
@@ -59,28 +49,25 @@ CREATE TABLE IF NOT EXISTS 'entries_fts_data'(id INTEGER PRIMARY KEY, block BLOB
|
||||
CREATE TABLE IF NOT EXISTS 'entries_fts_idx'(segid, term, pgno, PRIMARY KEY(segid, term)) WITHOUT ROWID;
|
||||
CREATE TABLE IF NOT EXISTS 'entries_fts_docsize'(id INTEGER PRIMARY KEY, sz BLOB);
|
||||
CREATE TABLE IF NOT EXISTS 'entries_fts_config'(k PRIMARY KEY, v) WITHOUT ROWID;
|
||||
CREATE TRIGGER entries_fts_after_insert
|
||||
AFTER INSERT ON entries
|
||||
BEGIN
|
||||
INSERT INTO entries_fts(rowid, fi, en, sv, no, ru, de, notes)
|
||||
VALUES (new.id, new.fi, new.en, new.sv, new.no, new.ru, new.de, new.notes);
|
||||
END;
|
||||
CREATE TRIGGER entries_fts_after_update
|
||||
AFTER UPDATE ON entries
|
||||
BEGIN
|
||||
INSERT INTO entries_fts(entries_fts, rowid, fi, en, sv, no, ru, de, notes)
|
||||
VALUES('delete', old.id, old.fi, old.en, old.sv, old.no, old.ru, old.de, old.notes);
|
||||
INSERT INTO entries_fts(rowid, fi, en, sv, no, ru, de, notes)
|
||||
VALUES (new.id, new.fi, new.en, new.sv, new.no, new.ru, new.de, new.notes);
|
||||
END;
|
||||
CREATE TRIGGER entries_fts_after_delete
|
||||
AFTER DELETE ON entries
|
||||
BEGIN
|
||||
INSERT INTO entries_fts(entries_fts, rowid, fi, en, sv, no, ru, de, notes)
|
||||
VALUES('delete', old.id, old.fi, old.en, old.sv, old.no, old.ru, old.de, old.notes);
|
||||
END;
|
||||
CREATE TABLE IF NOT EXISTS "setup_states" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "installed" boolean DEFAULT FALSE NOT NULL, "installed_at" datetime(6), "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL);
|
||||
CREATE TABLE IF NOT EXISTS "entries" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "category" integer DEFAULT 0 NOT NULL, "fi" varchar, "en" varchar, "sv" varchar, "no" varchar, "ru" varchar, "de" varchar, "notes" text, "verified" boolean DEFAULT FALSE NOT NULL, "created_by_id" integer, "updated_by_id" integer, "created_at" datetime(6) NOT NULL, "updated_at" datetime(6) NOT NULL, "status" integer DEFAULT 2 NOT NULL, "requested_by_id" integer, CONSTRAINT "fk_rails_6f84c41258"
|
||||
FOREIGN KEY ("updated_by_id")
|
||||
REFERENCES "users" ("id")
|
||||
, CONSTRAINT "fk_rails_367d1ab731"
|
||||
FOREIGN KEY ("created_by_id")
|
||||
REFERENCES "users" ("id")
|
||||
, CONSTRAINT "fk_rails_4d36fd8a36"
|
||||
FOREIGN KEY ("requested_by_id")
|
||||
REFERENCES "users" ("id")
|
||||
);
|
||||
CREATE INDEX "index_entries_on_created_by_id" ON "entries" ("created_by_id") /*application='SanastoWiki'*/;
|
||||
CREATE INDEX "index_entries_on_updated_by_id" ON "entries" ("updated_by_id") /*application='SanastoWiki'*/;
|
||||
CREATE INDEX "index_entries_on_category" ON "entries" ("category") /*application='SanastoWiki'*/;
|
||||
CREATE INDEX "index_entries_on_status" ON "entries" ("status") /*application='SanastoWiki'*/;
|
||||
CREATE INDEX "index_entries_on_requested_by_id" ON "entries" ("requested_by_id") /*application='SanastoWiki'*/;
|
||||
INSERT INTO "schema_migrations" (version) VALUES
|
||||
('20260129204706'),
|
||||
('20260129204705'),
|
||||
('20260123130957'),
|
||||
('20260123125325'),
|
||||
('20260122131000'),
|
||||
|
||||
Reference in New Issue
Block a user