mirror of
https://github.com/openziti/zrok.git
synced 2025-08-09 08:05:04 +02:00
organizing sqlite3 stuff to support postgres (#46)
This commit is contained in:
62
controller/store/sql/sqlite3/000_base.sql
Normal file
62
controller/store/sql/sqlite3/000_base.sql
Normal file
@ -0,0 +1,62 @@
|
||||
-- +migrate Up
|
||||
|
||||
--
|
||||
-- accounts
|
||||
--
|
||||
create table accounts (
|
||||
id integer primary key,
|
||||
email string not null unique,
|
||||
password string not null,
|
||||
token string not null unique,
|
||||
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
|
||||
constraint chk_email check (email <> ''),
|
||||
constraint chk_password check (password <> ''),
|
||||
constraint chk_token check(token <> '')
|
||||
);
|
||||
|
||||
--
|
||||
-- account_requests
|
||||
--
|
||||
create table account_requests (
|
||||
id integer primary key,
|
||||
token string not null unique,
|
||||
email string not null unique,
|
||||
source_address string not null,
|
||||
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now'))
|
||||
);
|
||||
|
||||
--
|
||||
-- environments
|
||||
--
|
||||
create table environments (
|
||||
id integer primary key,
|
||||
account_id integer constraint fk_accounts_identities references accounts on delete cascade,
|
||||
description string,
|
||||
host string,
|
||||
address string,
|
||||
z_id string not null unique,
|
||||
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
|
||||
constraint chk_z_id check (z_id <> '')
|
||||
);
|
||||
|
||||
--
|
||||
-- services
|
||||
--
|
||||
create table services (
|
||||
id integer primary key,
|
||||
environment_id integer constraint fk_environments_services references environments on delete cascade,
|
||||
z_id string not null unique,
|
||||
name string not null unique,
|
||||
frontend string,
|
||||
backend string,
|
||||
created_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
updated_at datetime not null default(strftime('%Y-%m-%d %H:%M:%f', 'now')),
|
||||
|
||||
constraint chk_z_id check (z_id <> ''),
|
||||
constraint chk_name check (name <> '')
|
||||
);
|
6
controller/store/sql/sqlite3/embed.go
Normal file
6
controller/store/sql/sqlite3/embed.go
Normal file
@ -0,0 +1,6 @@
|
||||
package sqlite3_schema
|
||||
|
||||
import "embed"
|
||||
|
||||
//go:embed *.sql
|
||||
var FS embed.FS
|
Reference in New Issue
Block a user