S SmartDocs
Series: Go sql 39 lines · Updated 2026-04-18

seed_data.sql

Go/Baasid/scripts/seed_data.sql

-- Baasid v1.1 — sample data for local development / demo
--
-- Default login (change in production!):
--   account  : admin
--   password : password
--
-- The bcrypt hash below was generated with Go's golang.org/x/crypto/bcrypt
-- (cost 10) for the plaintext "password". You can rotate it by running:
--
--   go run ./cmd/hashpw password
--
-- (Add hashpw utility if you want — for now the hash is embedded.)

INSERT INTO system_user ("_id", account, password, name)
VALUES (
    '11111111-1111-1111-1111-111111111111',
    'admin',
    -- bcrypt hash of the string "password" (same as Laravel default hash)
    '$2a$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
    '系統管理員'
)
ON CONFLICT (account) DO NOTHING;

-- Optional second user for multi-tenant experiments
INSERT INTO system_user ("_id", account, password, name)
VALUES (
    '22222222-2222-2222-2222-222222222222',
    'demo',
    '$2a$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
    'Demo User'
)
ON CONFLICT (account) DO NOTHING;

-- Sample goods rows (created / updated by admin user)
INSERT INTO goods ("_id", name, cr_user, up_user)
VALUES
    ('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', '示範商品 A', '11111111-1111-1111-1111-111111111111', '11111111-1111-1111-1111-111111111111'),
    ('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', '示範商品 B', '11111111-1111-1111-1111-111111111111', '11111111-1111-1111-1111-111111111111')
ON CONFLICT ("_id") DO NOTHING;

Related articles