-- Skrypt migracji podstawowych tabel
-- Data: 10.03.2025

-- 1. Migracja użytkowników
INSERT INTO domopieki_dev.users (id, name, email, password, role, phone_number, created_at, updated_at)
SELECT id, name, email, password, role, phone_number, created_at, updated_at
FROM domopieki.users;

-- 2. Migracja firm
INSERT INTO domopieki_dev.companies (id, name, nip, legal_form, regon, krs, address, city, postal_code, country, 
                                    phone, email, website, bank_name, bank_account, created_at, updated_at, is_active)
SELECT id, name, nip, legal_form, regon, krs, address, city, postal_code, country, 
       phone, email, website, bank_name, bank_account, created_at, updated_at, is_active
FROM domopieki.companies;

-- 3. Migracja typów kosztów
INSERT INTO domopieki_dev.cost_types (id, name, description, created_at, updated_at)
SELECT id, name, description, created_at, updated_at
FROM domopieki.cost_types;

-- 4. Migracja kategorii dokumentów
INSERT INTO domopieki_dev.document_categories (id, name, description, created_at, updated_at)
SELECT id, name, description, created_at, updated_at
FROM domopieki.document_categories;

-- 5. Migracja pojazdów
INSERT INTO domopieki_dev.vehicles (id, brand, model, year, registration_number, vin, purchase_date, 
                                   company_id, created_by, created_at, updated_at, first_registration_date)
SELECT id, brand, model, year, registration_number, vin, purchase_date, 
       company_id, created_by, created_at, updated_at, first_registration_date
FROM domopieki.vehicles; 