sql: change mysql auto_increment to sqlite autoincrement

master
King Kévin 3 months ago
parent a60e3063d1
commit dfe0f5c924
  1. 16
      schema.sql

@ -3,7 +3,7 @@ PRAGMA foreign_keys = ON;
-- part manufacturer
CREATE TABLE IF NOT EXISTS manufacturer (
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- index
id INTEGER PRIMARY KEY AUTOINCREMENT, -- index
name TEXT NOT NULL UNIQUE, -- manufacturer (expanded version, without legal form)
nick TEXT, -- manufacturer nickname
partof INTEGER, -- if the manufacturer has been acquired or is part of another
@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS manufacturer (
-- part distributor
CREATE TABLE IF NOT EXISTS distributor (
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- index
id INTEGER PRIMARY KEY AUTOINCREMENT, -- index
name TEXT NOT NULL UNIQUE,
homepage TEXT, -- URL to home page
product_page TEXT -- URL to product page (%s is replace by sku)
@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS distributor (
-- the part itself
CREATE TABLE IF NOT EXISTS part (
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- index
id INTEGER PRIMARY KEY AUTOINCREMENT, -- index
name TEXT NOT NULL UNIQUE,
description TEXT, -- a short (searchable) description
details TEXT, -- even more part details than just in the description
@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS assembly (
-- a part at a distributor
CREATE TABLE IF NOT EXISTS distribution (
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- index
id INTEGER PRIMARY KEY AUTOINCREMENT, -- index
part INTEGER NOT NULL, -- the part
distributor INTEGER NOT NULL, -- the part distributor
sku TEXT NOT NULL, -- distributor part number
@ -58,13 +58,13 @@ CREATE TABLE IF NOT EXISTS distribution (
-- part property
CREATE TABLE IF NOT EXISTS property (
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- index
id INTEGER PRIMARY KEY AUTOINCREMENT, -- index
name TEXT NOT NULL -- property name (min V, ...)
);
-- property value
CREATE TABLE IF NOT EXISTS properties (
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- index
id INTEGER PRIMARY KEY AUTOINCREMENT, -- index
part INTEGER NOT NULL, -- the part
property INTEGER NOT NULL,
value TEXT,
@ -74,14 +74,14 @@ CREATE TABLE IF NOT EXISTS properties (
-- part location
CREATE TABLE IF NOT EXISTS location (
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- index
id INTEGER PRIMARY KEY AUTOINCREMENT, -- index
name TEXT NOT NULL UNIQUE,
container TEXT -- container type
);
-- local stock
CREATE TABLE IF NOT EXISTS inventory (
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- index
id INTEGER PRIMARY KEY AUTOINCREMENT, -- index
part INTEGER NOT NULL,
location INTEGER,
quantity INTEGER NOT NULL,

Loading…
Cancel
Save