Skip to content

Instantly share code, notes, and snippets.

@luandro
Last active September 2, 2025 10:15
Show Gist options
  • Save luandro/5816839db0921b971175937ecdf30931 to your computer and use it in GitHub Desktop.
Save luandro/5816839db0921b971175937ecdf30931 to your computer and use it in GitHub Desktop.
πŸ“Š CORE DOMAIN TABLES:
==================================================
🏷️ COMMUNITIES:
β€’ id bigint NOT NULL
β€’ name character varying
β€’ locale character varying
β€’ country character varying
β€’ created_at timestamp without time zone NOT NULL
β€’ updated_at timestamp without time zone NOT NULL
β€’ beta boolean DEFAULT false
β€’ public boolean DEFAULT false NOT NULL
β€’ slug character varying
β€’ description text
🏷️ USERS:
β€’ id bigint NOT NULL
β€’ email character varying
β€’ encrypted_password character varying DEFAULT ''::character varying NOT NULL
β€’ reset_password_token character varying
β€’ reset_password_sent_at timestamp without time zone
β€’ remember_created_at timestamp without time zone
β€’ sign_in_count integer DEFAULT 0 NOT NULL
β€’ current_sign_in_at timestamp without time zone
β€’ last_sign_in_at timestamp without time zone
β€’ current_sign_in_ip character varying
... and 8 more columns
🏷️ STORIES:
β€’ id bigint NOT NULL
β€’ title character varying
β€’ desc text
β€’ created_at timestamp without time zone NOT NULL
β€’ updated_at timestamp without time zone NOT NULL
β€’ permission_level integer
β€’ date_interviewed timestamp without time zone
β€’ language character varying
β€’ interview_location_id integer
β€’ interviewer_id integer
... and 2 more columns
🏷️ PLACES:
β€’ id bigint NOT NULL
β€’ name character varying
β€’ type_of_place character varying
β€’ created_at timestamp without time zone NOT NULL
β€’ updated_at timestamp without time zone NOT NULL
β€’ lat numeric(10,6)
β€’ long numeric(10,6)
β€’ region character varying
β€’ description character varying
β€’ community_id integer
🏷️ SPEAKERS:
β€’ id bigint NOT NULL
β€’ name character varying
β€’ created_at timestamp without time zone NOT NULL
β€’ updated_at timestamp without time zone NOT NULL
β€’ birthdate timestamp without time zone
β€’ birthplace_id integer
β€’ speaker_community character varying
β€’ community_id integer
🏷️ THEMES:
β€’ id bigint NOT NULL
β€’ active boolean DEFAULT false NOT NULL
β€’ created_at timestamp without time zone NOT NULL
β€’ updated_at timestamp without time zone NOT NULL
β€’ mapbox_style_url character varying
β€’ mapbox_access_token character varying
β€’ center_lat numeric(10,6)
β€’ center_long numeric(10,6)
β€’ sw_boundary_lat numeric(10,6)
β€’ sw_boundary_long numeric(10,6)
... and 10 more columns
πŸ”— RELATIONSHIP TABLES:
==================================================
β€’ places_stories
- id bigint NOT NULL
- story_id bigint NOT NULL
- place_id bigint NOT NULL
β€’ speaker_stories
- id bigint NOT NULL
- speaker_id bigint NOT NULL
- story_id bigint NOT NULL
πŸ“± MEDIA TABLES (ActiveStorage):
==================================================
β€’ active_storage_attachments
β€’ active_storage_blobs
β€’ active_storage_variant_records
πŸ”— FOREIGN KEY RELATIONSHIPS:
==================================================
🎯 TYPESCRIPT MIGRATION INSIGHTS:
==================================================
πŸ“‹ Recommended TypeScript Types:
// Communities entity
interface Communities {
id: number;
name?: string;
locale?: string;
country?: string;
created_at: Date;
// ... other fields
}
// Users entity
interface Users {
id: number;
email?: string;
encrypted_password: string;
reset_password_token?: string;
reset_password_sent_at?: Date;
// ... other fields
}
// Stories entity
interface Stories {
id: number;
title?: string;
desc?: string;
created_at: Date;
updated_at: Date;
// ... other fields
}
// Places entity
interface Places {
id: number;
name?: string;
type_of_place?: string;
created_at: Date;
updated_at: Date;
// ... other fields
}
// Speakers entity
interface Speakers {
id: number;
name?: string;
created_at: Date;
updated_at: Date;
birthdate?: Date;
// ... other fields
}
// Themes entity
interface Themes {
id: number;
active: boolean;
created_at: Date;
updated_at: Date;
mapbox_style_url?: string;
// ... other fields
}
πŸ—ΊοΈ MIGRATION PRIORITY:
==================================================
1. Core entities: Community, User, Story, Place, Speaker
2. Relationship tables: story_places, story_speakers
3. Media system: ActiveStorage β†’ new media handling
4. Theme
5. Feature flags (flipper_*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment