fix migration number
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
-- User devices table
|
||||
CREATE TABLE user_devices (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
device_id VARCHAR(255) NOT NULL,
|
||||
device_name VARCHAR(255),
|
||||
device_type VARCHAR(50) CHECK (device_type IN ('mobile', 'tablet', 'desktop')),
|
||||
platform VARCHAR(50) CHECK (platform IN ('android', 'ios', 'web')),
|
||||
fcm_token VARCHAR(512),
|
||||
app_version VARCHAR(50),
|
||||
os_version VARCHAR(50),
|
||||
ip_address VARCHAR(45),
|
||||
last_active_at TIMESTAMP WITH TIME ZONE,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX idx_user_devices_user_id ON user_devices(user_id);
|
||||
CREATE INDEX idx_user_devices_device_id ON user_devices(device_id);
|
||||
CREATE INDEX idx_user_devices_fcm_token ON user_devices(fcm_token);
|
||||
CREATE UNIQUE INDEX idx_user_devices_user_device ON user_devices(user_id, device_id);
|
||||
Reference in New Issue
Block a user