You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.6 KiB
MySQL
65 lines
1.6 KiB
MySQL
2 years ago
|
DROP TABLE IF EXISTS instruments;
|
||
|
DROP TABLE IF EXISTS params;
|
||
|
DROP TABLE IF EXISTS sockets;
|
||
|
DROP TABLE IF EXISTS instrument_param;
|
||
|
DROP TABLE IF EXISTS instrument_socket;
|
||
|
DROP TABLE IF EXISTS patches;
|
||
|
DROP TABLE IF EXISTS patch_param;
|
||
|
DROP TABLE IF EXISTS snippets;
|
||
|
|
||
|
CREATE TABLE instruments (
|
||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||
|
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
name TEXT NOT NULL,
|
||
|
slug TEXT NOT NULL,
|
||
|
description TEXT NOT NULL,
|
||
|
panel TEXT NOT NULL
|
||
|
);
|
||
|
|
||
|
CREATE TABLE params (
|
||
|
param_name TEXT NOT NULL PRIMARY KEY
|
||
|
);
|
||
|
|
||
|
CREATE TABLE sockets (
|
||
|
socket_name TEXT NOT NULL PRIMARY KEY
|
||
|
);
|
||
|
|
||
|
CREATE TABLE instrument_param (
|
||
|
instrument_id INTEGER NOT NULL,
|
||
|
param_name TEXT NOT NULL,
|
||
|
PRIMARY KEY (instrument_id, param_name)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE instrument_socket (
|
||
|
instrument_id INTEGER NOT NULL,
|
||
|
socket_name TEXT NOT NULL,
|
||
|
PRIMARY KEY (instrument_id, socket_name)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE patches (
|
||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||
|
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
name TEXT NOT NULL,
|
||
|
slug TEXT NOT NULL,
|
||
|
description TEXT NOT NULL,
|
||
|
cables TEXT NOT NULL,
|
||
|
instrument TEXT NOT NULL,
|
||
|
FOREIGN KEY (instrument) REFERENCES instruments(slug)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE patch_param (
|
||
|
patch_id INTEGER NOT NULL,
|
||
|
param_name TEXT NOT NULL,
|
||
|
value TEXT NOT NULL,
|
||
|
PRIMARY KEY (patch_id, param_name)
|
||
|
);
|
||
|
|
||
|
CREATE TABLE snippets (
|
||
|
filename TEXT NOT NULL,
|
||
|
instrument TEXT NOT NULL,
|
||
|
patch_name TEXT NOT NULL,
|
||
|
description TEXT NOT NULL,
|
||
|
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||
|
);
|
||
|
|