Files
riksdagen-app/database/migrations/2025_12_27_000000_create_riksdagen_tables.php

341 lines
16 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
// dokument
Schema::create('dokument', function (Blueprint $table) {
$table->integer('hangar_id');
$table->string('dok_id');
$table->string('rm');
$table->string('beteckning')->nullable();
$table->string('typ')->nullable();
$table->string('subtyp')->nullable();
$table->string('doktyp')->nullable();
$table->string('typrubrik')->nullable();
$table->string('dokumentnamn')->nullable();
$table->string('debattnamn')->nullable();
$table->string('tempbeteckning')->nullable();
$table->string('organ')->nullable();
$table->string('mottagare')->nullable();
$table->integer('nummer')->nullable();
$table->integer('slutnummer')->nullable();
$table->dateTime('datum')->nullable();
$table->dateTime('systemdatum')->nullable();
$table->dateTime('publicerad')->nullable();
$table->string('titel')->nullable();
$table->string('subtitel')->nullable();
$table->string('status')->nullable();
$table->string('htmlformat')->nullable();
$table->string('relaterat_id')->nullable();
$table->string('source')->nullable();
$table->string('sourceid')->nullable();
$table->string('dokument_url_text')->nullable();
$table->string('dokument_url_html')->nullable();
$table->string('dokumentstatus_url_xml')->nullable();
$table->string('utskottsforslag_url_xml')->nullable();
$table->text('html')->nullable();
});
// dokutskottsforslag
Schema::create('dokutskottsforslag', function (Blueprint $table) {
$table->integer('hangar_id');
$table->integer('punkt');
$table->string('beteckning', 50)->nullable();
$table->string('rubrik')->nullable();
$table->string('forslag')->nullable();
$table->text('forslag_del2')->nullable();
$table->string('beslutstyp')->nullable();
$table->string('beslut', 100)->nullable();
$table->integer('motforslag_nummer')->nullable();
$table->string('motforslag_partier')->nullable();
$table->string('votering_id')->nullable();
$table->string('votering_sammanfattning_html')->nullable();
$table->string('votering_ledamot_url_xml')->nullable();
$table->string('rm')->nullable();
$table->string('bet')->nullable();
$table->string('vinnare')->nullable();
});
// dokmotforslag
Schema::create('dokmotforslag', function (Blueprint $table) {
$table->integer('hangar_id');
$table->integer('nummer');
$table->string('rubrik')->nullable();
$table->text('forslag')->nullable();
$table->string('partier')->nullable();
$table->string('typ')->nullable();
$table->integer('utskottsforslag_punkt')->nullable();
$table->string('id', 50)->nullable();
});
// dokaktivitet
Schema::create('dokaktivitet', function (Blueprint $table) {
$table->integer('hangar_id');
$table->string('kod')->nullable();
$table->string('namn')->nullable();
$table->dateTime('datum')->nullable();
$table->string('status')->nullable();
$table->string('ordning')->nullable();
$table->string('process')->nullable();
});
// dokintressent
Schema::create('dokintressent', function (Blueprint $table) {
$table->integer('hangar_id');
$table->string('intressent_id');
$table->string('namn')->nullable();
$table->string('partibet')->nullable();
$table->integer('ordning')->nullable();
$table->string('roll')->nullable();
});
// dokforslag
Schema::create('dokforslag', function (Blueprint $table) {
$table->integer('hangar_id');
$table->integer('nummer')->nullable();
$table->string('beteckning')->nullable();
$table->string('lydelse', 500)->nullable();
$table->string('lydelse2')->nullable();
$table->string('utskottet')->nullable();
$table->string('kammaren')->nullable();
$table->string('behandlas_i')->nullable();
$table->string('behandlas_i_punkt')->nullable();
$table->string('kammarbeslutstyp')->nullable();
$table->string('intressent')->nullable();
$table->string('avsnitt')->nullable();
$table->string('grundforfattning')->nullable();
$table->string('andringsforfattning')->nullable();
});
// dokuppgift
Schema::create('dokuppgift', function (Blueprint $table) {
$table->integer('hangar_id');
$table->string('kod')->nullable();
$table->string('namn')->nullable();
$table->text('text')->nullable();
$table->string('dok_id')->nullable();
$table->dateTime('systemdatum')->nullable();
});
// dokbilaga
Schema::create('dokbilaga', function (Blueprint $table) {
$table->integer('hangar_id');
$table->string('dok_id')->nullable();
$table->string('titel')->nullable();
$table->string('subtitel')->nullable();
$table->string('filnamn')->nullable();
$table->integer('filstorlek')->nullable();
$table->string('filtyp')->nullable();
$table->string('fil_url')->nullable();
});
// dokreferens
Schema::create('dokreferens', function (Blueprint $table) {
$table->integer('hangar_id');
$table->string('referenstyp')->nullable();
$table->string('uppgift')->nullable();
$table->string('ref_dok_id')->nullable();
$table->string('ref_dok_typ')->nullable();
$table->string('ref_dok_rm')->nullable();
$table->string('ref_dok_bet')->nullable();
$table->string('ref_dok_titel')->nullable();
$table->string('ref_dok_subtitel')->nullable();
$table->string('ref_dok_subtyp')->nullable();
$table->string('ref_dok_dokumentnamn')->nullable();
});
// debatt
Schema::create('debatt', function (Blueprint $table) {
$table->integer('hangar_id');
$table->string('video_id')->nullable();
$table->string('video_url')->nullable();
$table->integer('startpos')->nullable();
$table->string('tumnagel')->nullable();
$table->string('tumnagel_stor')->nullable();
$table->string('anf_video_id')->nullable();
$table->integer('anf_hangar_id')->nullable();
$table->integer('anf_sekunder')->nullable();
$table->string('anf_klockslag')->nullable();
$table->dateTime('datumtid')->nullable();
$table->dateTime('anf_datum')->nullable();
$table->string('anf_typ')->nullable();
$table->string('anf_text')->nullable();
$table->string('anf_beteckning')->nullable();
$table->string('anf_nummer')->nullable();
$table->string('talare')->nullable();
$table->string('intressent_id')->nullable();
$table->string('parti')->nullable();
$table->string('anf_rm')->nullable();
});
// votering
Schema::create('votering', function (Blueprint $table) {
$table->string('rm');
$table->string('beteckning')->nullable();
$table->integer('hangar_id');
$table->string('votering_id')->nullable();
$table->integer('punkt')->nullable();
$table->string('namn')->nullable();
$table->string('intressent_id')->nullable();
$table->string('parti')->nullable();
$table->string('valkrets')->nullable();
$table->integer('valkretsnummer')->nullable();
$table->string('iort')->nullable();
$table->string('rost')->nullable();
$table->string('avser')->nullable();
$table->string('votering')->nullable();
$table->integer('banknummer')->nullable();
$table->string('fornamn')->nullable();
$table->string('efternamn')->nullable();
$table->string('kon')->nullable();
$table->integer('fodd')->nullable();
$table->dateTime('datum')->nullable();
});
// anforande
Schema::create('anforande', function (Blueprint $table) {
$table->integer('dok_hangar_id');
$table->string('dok_id', 50);
$table->string('dok_titel')->nullable();
$table->string('dok_rm', 20)->nullable();
$table->integer('dok_nummer')->nullable();
$table->dateTime('dok_datum')->nullable();
$table->string('avsnittsrubrik')->nullable();
$table->string('underrubrik')->nullable();
$table->string('kammaraktivitet', 250)->nullable();
$table->string('anforande_id', 50);
$table->integer('anforande_nummer')->nullable();
$table->string('talare', 250)->nullable();
$table->string('parti', 50)->nullable();
$table->text('anforandetext')->nullable();
$table->string('intressent_id', 50)->nullable();
$table->string('rel_dok_id', 50)->nullable();
$table->char('replik', 1)->nullable();
$table->dateTime('systemdatum')->nullable();
});
// person
Schema::create('person', function (Blueprint $table) {
$table->string('intressent_id', 20)->primary();
$table->smallInteger('född_år')->nullable();
$table->string('kön', 6)->nullable();
$table->string('efternamn', 50)->nullable();
$table->string('tilltalsnamn', 50)->nullable();
$table->string('sorteringsnamn', 80)->nullable();
$table->string('iort', 40)->nullable();
$table->string('parti', 40)->nullable();
$table->string('valkrets', 50)->nullable();
$table->string('status', 100)->nullable();
});
// personuppdrag
Schema::create('personuppdrag', function (Blueprint $table) {
$table->string('organ_kod', 20);
$table->string('roll_kod', 40);
$table->integer('ordningsnummer');
$table->string('status', 20)->nullable();
$table->string('typ', 20)->nullable();
$table->dateTime('from')->nullable();
$table->dateTime('tom')->nullable();
$table->string('uppgift', 500)->nullable();
$table->string('intressent_id', 50);
});
// personuppgift
Schema::create('personuppgift', function (Blueprint $table) {
$table->string('uppgift_kod', 50);
$table->text('uppgift')->nullable();
$table->string('uppgift_typ', 50)->nullable();
$table->string('intressent_id', 50);
});
// planering
Schema::create('planering', function (Blueprint $table) {
$table->integer('nyckel');
$table->string('id', 50);
$table->string('rm', 12)->nullable();
$table->string('typ', 40)->nullable();
$table->char('dokserie_id', 2)->nullable();
$table->string('subtyp', 40)->nullable();
$table->string('bet', 40)->nullable();
$table->string('tempbet', 40)->nullable();
$table->string('intressent', 80)->nullable();
$table->integer('nummer')->nullable();
$table->integer('slutnummer')->nullable();
$table->dateTime('datum')->nullable();
$table->dateTime('publicerad')->nullable();
$table->string('status', 40)->nullable();
$table->string('titel', 300)->nullable();
$table->string('subtitel', 255)->nullable();
$table->text('html')->nullable();
$table->text('toc')->nullable();
$table->string('refcss', 66)->nullable();
$table->string('url', 100)->nullable();
$table->dateTime('uppdaterad')->nullable();
$table->integer('storlek')->nullable();
$table->string('source', 20)->nullable();
$table->dateTime('wn_expires')->nullable();
$table->string('wn_cachekey', 50)->nullable();
$table->string('wn_status', 20)->nullable();
$table->string('wn_checksum', 40)->nullable();
$table->integer('wn_nid')->nullable();
$table->string('wn_RawUrl', 255)->nullable();
$table->string('wn_SourceID', 80)->nullable();
$table->dateTime('timestamp')->nullable();
$table->string('rel_id', 50)->nullable();
$table->string('klockslag', 10)->nullable();
$table->string('grupp', 20)->nullable();
$table->string('format', 20)->nullable();
$table->string('intressent_id', 13)->nullable();
$table->string('mottagare_id', 13)->nullable();
$table->string('mottagare', 80)->nullable();
$table->integer('hangar_id')->nullable();
$table->string('plats', 150)->nullable();
$table->dateTime('slutdatum')->nullable();
$table->tinyInteger('webbtvlive')->nullable();
});
// organ
Schema::create('organ', function (Blueprint $table) {
$table->integer('id')->primary();
$table->string('kod', 50)->nullable();
$table->string('namn', 100)->nullable();
$table->string('typ', 50)->nullable();
$table->string('status', 12)->nullable();
$table->integer('sortering')->nullable();
$table->string('namn_en', 100)->nullable();
$table->string('domän', 50)->nullable();
$table->string('beskrivning', 1000)->nullable();
});
// roll
Schema::create('roll', function (Blueprint $table) {
$table->integer('pk')->primary();
$table->string('kod', 50)->nullable();
$table->string('namn', 100)->nullable();
$table->integer('sort')->nullable();
});
// riksmote
Schema::create('riksmote', function (Blueprint $table) {
$table->integer('pk')->primary();
$table->string('riksmote', 20)->nullable();
$table->string('id', 3)->nullable();
$table->dateTime('start')->nullable();
$table->dateTime('slut')->nullable();
$table->string('mandatperiod', 20)->nullable();
});
}
public function down()
{
Schema::dropIfExists('dokument');
Schema::dropIfExists('dokutskottsforslag');
Schema::dropIfExists('dokmotforslag');
Schema::dropIfExists('dokaktivitet');
Schema::dropIfExists('dokintressent');
Schema::dropIfExists('dokforslag');
Schema::dropIfExists('dokuppgift');
Schema::dropIfExists('dokbilaga');
Schema::dropIfExists('dokreferens');
Schema::dropIfExists('debatt');
Schema::dropIfExists('votering');
Schema::dropIfExists('anforande');
Schema::dropIfExists('person');
Schema::dropIfExists('personuppdrag');
Schema::dropIfExists('personuppgift');
Schema::dropIfExists('planering');
Schema::dropIfExists('organ');
Schema::dropIfExists('roll');
Schema::dropIfExists('riksmote');
}
};