Initial commit
This commit is contained in:
27
internal/db/seed.go
Normal file
27
internal/db/seed.go
Normal file
@ -0,0 +1,27 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"github.com/scylladb/gocqlx/v2"
|
||||
)
|
||||
|
||||
func Seed(session gocqlx.Session) error {
|
||||
err := session.ExecStmt(`
|
||||
CREATE KEYSPACE IF NOT EXISTS fivefeeteleven
|
||||
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = session.ExecStmt(`
|
||||
CREATE TABLE IF NOT EXISTS fivefeeteleven.urls (
|
||||
id text PRIMARY KEY,
|
||||
redirect_url text,
|
||||
secret text
|
||||
)`)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user