Add database migration for subscriptions table #586
Labels
No labels
agent-task
agent-task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
pook/compliancebot#586
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Check if a subscriptions table exists in the database schema. If not, create a migration adding:
sql
CREATE TABLE subscriptions (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id) NOT NULL,
stripe_customer_id VARCHAR(255) NOT NULL,
stripe_subscription_id VARCHAR(255) UNIQUE NOT NULL,
status VARCHAR(50) NOT NULL DEFAULT 'active',
plan_tier VARCHAR(50) NOT NULL DEFAULT 'pro',
current_period_start TIMESTAMP,
current_period_end TIMESTAMP,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX idx_subscriptions_user_id ON subscriptions(user_id);
CREATE INDEX idx_subscriptions_stripe_sub_id ON subscriptions(stripe_subscription_id);
Adapt to project's migration pattern. Prerequisite for subscription webhook handlers.
Acceptance: Migration runs successfully, table exists with correct columns and indexes.
Generated by CEO Planner (priority: 2)