username VARCHAR UNIQUE NOT NULL, email VARCHAR UNIQUE NOT NULL, password VARCHAR NOT NULL, createdAt TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP );CREATE TABLE IF NOT EXISTS notes ( id SERIAL PRIMARY KEY, message VARCHAR NOT...
CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY,username VARCHAR UNIQUE NOT NULL,email VARCHAR UNIQUE NOT NULL,password VARCHAR NOT NULL,createdAt TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP); CREATE TABLE IF NOT EXISTS notes (id SERIAL PRIMARY KEY,message VARCHAR NOT NULL,owner ...
CREATE TABLE IF NOT EXISTS users (id SERIAL PRIMARY KEY,username VARCHAR UNIQUE NOT NULL,email VARCHAR UNIQUE NOT NULL,password VARCHAR NOT NULL,createdAt TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP CREATE TABLE IF NOT EXISTS notes (id SERIAL PRIMARY KEY,message VARCHAR NOT NULL,owner VARC...
CREATE TABLE IF NOT EXISTS sessions ( id SERIAL PRIMARY KEY, session_id VARCHAR NOT NULL UNIQUE, user_id INT NOT NULL UNIQUE ); 迁移会自动运行。但如果大家想要手动操作,也可以使用 sqlx migrate run --database-url。这种操作之所以可行,是因为我们已经将 SQL 文件设置为幂等,就是说只要已经存在该表...
CREATETABLEIFNOTEXISTSnotes(idSERIALPRIMARYKEY,messageVARCHARNOTNULL,ownerVARCHARNOTNULL,createdAtTIMESTAMPWITHTIMEZONEDEFAULTCURRENT_TIMESTAMP);INSERTINTOnotes(message,owner)VALUES('Hello world!','user');CREATETABLEIFNOTEXISTSsessions(idSERIALPRIMARYKEY,session_idVARCHARNOTNULLUNIQUE,user_idINTNOTNULLUNIQUE)...
Create the folder at path on the filesystem 创建文件夹 package main import ( "fmt" "os" ) func main() { path := "foo" _, err := os.Stat(path) b := !os.IsNotExist(err) fmt.Println(path, "exists:", b) err = os.Mkdir(path, os.ModeDir) if err != nil { panic(err) ...
if2: Renamed function name to foo_if_fizz. move_semantics: Clarified some hints. quiz1: Renamed the function name to be more verbose. structs1: Use an integer type instead of strings. Renamed "unit structs" to "unit-like structs", as is used in the book. structs3: Added the panic!
For example, our CREATE statement will be in the up.sql file: -- Your SQL goes here CREATE TABLE IF NOT EXISTS tasks ( id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL, description TEXT NOT NULL ); And the corresponding statement will be in the down.sql file: DROP TABLE tasks; ...
if2: Renamed function name to foo_if_fizz. move_semantics: Clarified some hints. quiz1: Renamed the function name to be more verbose. structs1: Use an integer type instead of strings. Renamed "unit structs" to "unit-like structs", as is used in the book. structs3: Added the panic!
If you have multiple private repositories, add them accordingly. Now, go into the environment variables page of your application and create those environment variables: GIT_USERNAME: your Github / gitlab / other username GIT_PASSWORD: your Github / gitlab / other password ...