-- Gelir Gider Muhasebe Database Export
-- Export Date: 2025-06-30 20:49:30

-- Table: users
CREATE TABLE IF NOT EXISTS "users" ("id" integer primary key autoincrement not null, "name" varchar not null, "email" varchar not null, "email_verified_at" datetime, "password" varchar not null, "remember_token" varchar, "created_at" datetime, "updated_at" datetime);

INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('1', 'Demo User', 'demo@gelir-gider.com', NULL, '$2y$10$MntSr1RjzKO3SzAkKDntnuCsHFlOKDBS8CuVSR92CIBvBDfwxs0v.', NULL, '2025-06-30 20:46:09', '2025-06-30 20:46:09');
INSERT INTO `users` (`id`, `name`, `email`, `email_verified_at`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES ('2', 'Admin User', 'admin@gelir-gider.com', NULL, '$2y$10$VCR48C.yRPsseo0pTgJK6eVDHtIqn9Nehc4qY2ebLTAOPQ/AFGAV.', NULL, '2025-06-30 20:46:09', '2025-06-30 20:46:09');

-- Table: sessions
CREATE TABLE IF NOT EXISTS "sessions" ("id" varchar not null, "user_id" integer, "ip_address" varchar, "user_agent" text, "payload" text not null, "last_activity" integer not null, primary key ("id"));


-- Table: cache
CREATE TABLE IF NOT EXISTS "cache" ("key" varchar not null, "value" text not null, "expiration" integer not null, primary key ("key"));


-- Table: categories
CREATE TABLE IF NOT EXISTS "categories" ("id" integer primary key autoincrement not null, "user_id" integer not null, "name" varchar not null, "description" text, "color" varchar not null default '#10B981', "icon" varchar not null default 'wallet', "type" varchar check ("type" in ('income', 'expense', 'both')) not null default 'income', "is_active" tinyint(1) not null default '1', "created_at" datetime, "updated_at" datetime, foreign key("user_id") references "users"("id") on delete cascade);


-- Table: income_sources
CREATE TABLE IF NOT EXISTS "income_sources" ("id" integer primary key autoincrement not null, "user_id" integer not null, "name" varchar not null, "description" text, "total_amount" numeric not null, "remaining_amount" numeric not null, "color" varchar not null default '#10B981', "is_active" tinyint(1) not null default '1', "created_at" datetime, "updated_at" datetime, foreign key("user_id") references "users"("id") on delete cascade);


-- Table: incomes
CREATE TABLE IF NOT EXISTS "incomes" ("id" integer primary key autoincrement not null, "user_id" integer not null, "income_source_id" integer not null, "category_id" integer not null, "title" varchar not null, "amount" numeric not null, "income_date" date not null, "recurring_type" varchar check ("recurring_type" in ('daily', 'weekly', 'monthly', 'yearly')), "notes" text, "created_at" datetime, "updated_at" datetime, foreign key("user_id") references "users"("id") on delete cascade, foreign key("income_source_id") references "income_sources"("id") on delete cascade, foreign key("category_id") references "categories"("id") on delete cascade);


-- Table: expenses
CREATE TABLE IF NOT EXISTS "expenses" ("id" integer primary key autoincrement not null, "user_id" integer not null, "category_id" integer not null, "title" varchar not null, "amount" numeric not null, "expense_date" date not null, "recurring_type" varchar check ("recurring_type" in ('daily', 'weekly', 'monthly', 'yearly')), "notes" text, "created_at" datetime, "updated_at" datetime, foreign key("user_id") references "users"("id") on delete cascade, foreign key("category_id") references "categories"("id") on delete cascade);


-- Table: jobs
CREATE TABLE IF NOT EXISTS "jobs" ("id" integer primary key autoincrement not null, "queue" varchar not null, "payload" text not null, "attempts" integer not null, "reserved_at" integer, "available_at" integer not null, "created_at" integer not null);


