data.sql 1.3 KB

1234567891011121314151617181920212223
  1. --
  2. -- File generated with SQLiteStudio v3.3.3 on Thu May 26 17:08:57 2022
  3. --
  4. -- Text encoding used: UTF-8
  5. --
  6. PRAGMA foreign_keys = off;
  7. BEGIN TRANSACTION;
  8. -- Table: posts
  9. DROP TABLE IF EXISTS posts;
  10. CREATE TABLE posts (id INTEGER PRIMARY KEY ASC ON CONFLICT FAIL AUTOINCREMENT NOT NULL ON CONFLICT FAIL, title VARCHAR (150) NOT NULL UNIQUE, html TEXT NOT NULL DEFAULT (''), markdown TEXT NOT NULL DEFAULT (''), tags VARCHAR (500) NOT NULL DEFAULT (''), language CHAR (2) NOT NULL DEFAULT ES, slug VARCHAR (350) NOT NULL DEFAULT (''), status VARCHAR (15) DEFAULT DRAFT CHECK (status IN ('DRAFT', 'PUBLISHED', 'SYNCHRONIZE')) NOT NULL, translation_id INT REFERENCES translations (id) ON DELETE RESTRICT ON UPDATE CASCADE NOT NULL DEFAULT (0), created_at DATETIME DEFAULT (CURRENT_TIMESTAMP) NOT NULL, updated_at DATETIME DEFAULT (CURRENT_TIMESTAMP));
  11. -- Table: translations
  12. DROP TABLE IF EXISTS translations;
  13. CREATE TABLE translations (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, count INT DEFAULT (0) NOT NULL);
  14. -- Trigger: before_upd
  15. DROP TRIGGER IF EXISTS before_upd;
  16. CREATE TRIGGER before_upd BEFORE UPDATE OF id, title, html, markdown, tags, language, slug, translation_id ON posts BEGIN UPDATE posts SET updated_at = DATETIME('NOW') WHERE id = OLD.id; END;
  17. COMMIT TRANSACTION;
  18. PRAGMA foreign_keys = on;