Skip to content

Commit

Permalink
seed demo companies
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirAgassi committed Dec 8, 2024
1 parent a8f7a53 commit a6b8549
Showing 1 changed file with 165 additions and 0 deletions.
165 changes: 165 additions & 0 deletions backend/.sqlc/migrations/20241221000002_seed_demo_companies.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
-- +goose Up
-- +goose StatementBegin

-- get the startup owner's user id
WITH startup_user AS (
SELECT id FROM users WHERE email = '[email protected]' LIMIT 1
)
-- create demo companies
INSERT INTO companies (
id,
owner_user_id,
name,
description,
is_verified,
created_at,
updated_at
)
SELECT
gen_random_uuid(),
startup_user.id,
name,
description,
is_verified,
created_at,
updated_at
FROM startup_user, (VALUES
(
'TechVision AI',
'An AI company focusing on computer vision solutions for autonomous vehicles',
true,
NOW() - INTERVAL '30 days',
NOW() - INTERVAL '2 days'
),
(
'GreenEnergy Solutions',
'Developing innovative solar panel technology for residential use',
true,
NOW() - INTERVAL '60 days',
NOW() - INTERVAL '5 days'
),
(
'HealthTech Pro',
'Healthcare technology focusing on remote patient monitoring',
false,
NOW() - INTERVAL '1 day',
NOW() - INTERVAL '1 day'
),
(
'EduLearn Platform',
'Online education platform with AI-powered personalized learning',
true,
NOW() - INTERVAL '90 days',
NOW() - INTERVAL '10 days'
),
(
'FinTech Solutions',
'Blockchain-based payment solutions for cross-border transactions',
false,
NOW() - INTERVAL '2 days',
NOW() - INTERVAL '2 days'
)
) AS t(name, description, is_verified, created_at, updated_at);

-- Add some company financials
WITH companies_to_update AS (
SELECT id, name FROM companies
WHERE name IN ('TechVision AI', 'GreenEnergy Solutions', 'EduLearn Platform')
)
INSERT INTO company_financials (
company_id,
financial_year,
revenue,
expenses,
profit,
sales,
amount_raised,
arr,
grants_received
)
SELECT
id,
2023,
1000000.00, -- revenue
800000.00, -- expenses
200000.00, -- profit
1200000.00, -- sales
500000.00, -- amount raised
960000.00, -- arr
50000.00 -- grants
FROM companies_to_update;

-- Add some employees
WITH companies_to_update AS (
SELECT id, name FROM companies
WHERE name IN ('TechVision AI', 'GreenEnergy Solutions')
)
INSERT INTO employees (
company_id,
name,
email,
role,
bio
)
SELECT
c.id,
e.name,
e.email,
e.role,
e.bio
FROM companies_to_update c
CROSS JOIN (VALUES
(
'John Smith',
'[email protected]',
'CTO',
'Experienced AI researcher with 10+ years in computer vision'
),
(
'Sarah Johnson',
'[email protected]',
'Lead Engineer',
'Senior software engineer specializing in deep learning'
),
(
'Michael Green',
'[email protected]',
'CEO',
'Serial entrepreneur with background in renewable energy'
),
(
'Lisa Chen',
'[email protected]',
'Head of R&D',
'PhD in Material Science with focus on solar technology'
)
) AS e(name, email, role, bio)
WHERE
(c.name = 'TechVision AI' AND e.email LIKE '%techvision%') OR
(c.name = 'GreenEnergy Solutions' AND e.email LIKE '%greenenergy%');

-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin

-- Delete seeded employees
DELETE FROM employees
WHERE email IN (
'[email protected]',
'[email protected]',
'[email protected]',
'[email protected]'
);

-- Delete seeded financials and companies
DELETE FROM companies
WHERE name IN (
'TechVision AI',
'GreenEnergy Solutions',
'HealthTech Pro',
'EduLearn Platform',
'FinTech Solutions'
);

-- +goose StatementEnd

0 comments on commit a6b8549

Please sign in to comment.