Skip to content

Instantly share code, notes, and snippets.

@harshitsinghai77
Created November 4, 2020 08:29
Show Gist options
  • Save harshitsinghai77/4cc855a1b8cc0cc4e34d996f797291ff to your computer and use it in GitHub Desktop.
Save harshitsinghai77/4cc855a1b8cc0cc4e34d996f797291ff to your computer and use it in GitHub Desktop.
Go models.go file using go-sqlite3
package dbutils
const clubs = `
CREATE TABLE IF NOT EXISTS clubs (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
NAME VARCHAR(64) NOT NULL,
COUNTRY VARCHAR(64) NOT NULL,
STADIUM VARCHAR(64) NOT NULL,
CreatedAt TIME NULL
)
`
const players = `
CREATE TABLE IF NOT EXISTS players (
ID INTEGER PRIMARY KEY AUTOINCREMENT,
NAME VARCHAR(64) NOT NULL,
ClubID INT,
AGE INTEGER,
POSITION VARCHAR(64) NOT NULL,
CreatedAt TIME NULL,
FOREIGN KEY (ClubID) REFERENCES clubs(ID)
)
`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment