testdb_schema.sql 297 B

123456789101112131415161718
  1. --
  2. -- testdb schema
  3. --
  4. CREATE TABLE category (
  5. id bigserial,
  6. title text,
  7. PRIMARY KEY (id)
  8. );
  9. CREATE TABLE item (
  10. id bigserial,
  11. category_id bigint,
  12. title text,
  13. num int,
  14. PRIMARY KEY (id),
  15. FOREIGN KEY (category_id) REFERENCES category (id) ON DELETE SET NULL
  16. );