Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4f170f4
add support for taxonomies
May 19, 2021
b166029
add db support for globals
May 19, 2021
19830ac
rename terms table
May 19, 2021
9a21d89
fix taxonomy id
May 19, 2021
3d5e4f1
add migrations
May 19, 2021
f4559d9
update readme
May 19, 2021
b1988f4
allow taxonomy to be null
May 27, 2021
b34be34
bring back global transform
May 27, 2021
7bc9d42
add db support for navigations
May 27, 2021
68bafd2
add db support for collections
May 27, 2021
ece0fcc
multisite notice
May 27, 2021
7b57aab
cleanup
May 28, 2021
300c05f
add collections migration
May 28, 2021
2665601
fix collection structure field and cleanup
May 28, 2021
743e376
ingore .php_cs.cache
May 31, 2021
b6d5085
fix code style
May 31, 2021
8344245
make tree model semi polymorph and move files to appropriate folder
May 31, 2021
00db449
add support for collection tree
May 31, 2021
f02b53a
Fix NavTree Model
May 31, 2021
40186dc
Fix sites type on collections
Jun 1, 2021
7b5f662
multisite navigations
benaja Jul 6, 2021
71851fb
add multisite functionality to taxonomies
benaja Jul 6, 2021
9402bc6
localize taxonomies
benaja Jul 6, 2021
d9d9255
ability to customize entry
benaja Jul 12, 2021
dc29b47
get collection tree by site
benaja Jul 13, 2021
58b5971
return localized field when fetching terms by site
benaja Jul 27, 2021
6be137c
optional return
benaja Jul 27, 2021
0ee57a1
only use updated_at from database column and don't track more than once
Jul 27, 2021
528e1fc
save sites to taxonomy and add fallback for terms
Aug 3, 2021
fc838a8
Allows customizing the collection entry class.
juliomenendez Sep 20, 2021
8900f27
Merge pull request #1 from RoqLogic/feature/support-custom-collection…
juliomenendez Sep 20, 2021
a48b880
Defines collection bindings before repositories.
juliomenendez Sep 20, 2021
4540612
Adds blueprints to the database.
juliomenendez Sep 27, 2021
7bc24a7
Adds fieldsets to the database.
juliomenendez Sep 27, 2021
415e68d
Loads migrations automatically.
juliomenendez Sep 27, 2021
5414910
Fixes path to database directory.
juliomenendez Sep 27, 2021
2a1327d
Removes auto loading migrations.
juliomenendez Sep 27, 2021
5bfc246
Sets correct namespace for the seeder.
juliomenendez Sep 27, 2021
8fccf76
Stops running the seeder automatically.
juliomenendez Sep 27, 2021
6cca9e8
Sets seeder to use handle instead of id for lookup.
juliomenendez Sep 27, 2021
c83823e
Adds asset containers to the database.
juliomenendez Sep 29, 2021
a1c01a8
Adds roles to the database.
juliomenendez Oct 6, 2021
a816875
Adds user groups to the database.
juliomenendez Oct 6, 2021
d77e62a
Merge branch 'master' into feature/support-all-models
juliomenendez Feb 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
composer.lock
vendor
.phpunit.result.cache
.php_cs.cache
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

This package provides support for storing your Statamic data in a database rather than the filesystem.

This driver currently supports entries but not taxonomies, navigations, globals, or form submissions. We'll be working on those in the future.

## Installation

Install using Composer:

```
composer require statamic/eloquent-driver
```
Expand All @@ -19,7 +18,6 @@ php artisan vendor:publish --tag="statamic-eloquent-config"

Since Statamic uses UUIDs within content files by default, we provide two solutions depending on whether you need to use existing content.


### Fresh install of [statamic/statamic](https://github.com/statamic/statamic) (using incrementing ids)

If you're starting from scratch, we can use traditional incrementing integers for IDs.
Expand Down
44 changes: 44 additions & 0 deletions config/eloquent-driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@

'entries' => [
'model' => \Statamic\Eloquent\Entries\EntryModel::class,
'entry' => \Statamic\Eloquent\Entries\Entry::class,
],

'collections' => [
'model' => \Statamic\Eloquent\Collections\CollectionModel::class,
'entry' => \Statamic\Eloquent\Collections\Collection::class,
],

'trees' => [
'model' => \Statamic\Eloquent\Structures\TreeModel::class,
],

'taxonomies' => [
'model' => \Statamic\Eloquent\Taxonomies\TaxonomyModel::class,
],

'terms' => [
'model' => \Statamic\Eloquent\Taxonomies\TermModel::class,
],

'global-sets' => [
'model' => \Statamic\Eloquent\Globals\GlobalSetModel::class,
],

'variables' => [
'model' => \Statamic\Eloquent\Globals\VariablesModel::class,
],

'navigations' => [
'model' => \Statamic\Eloquent\Structures\NavModel::class,
],

'nav-trees' => [
'model' => \Statamic\Eloquent\Structures\NavTreeModel::class,
],

'roles' => [
'model' => \Statamic\Eloquent\Auth\RoleModel::class,
'entry' => \Statamic\Eloquent\Auth\Role::class,
],

'groups' => [
'model' => \Statamic\Eloquent\Auth\UserGroupModel::class,
'entry' => \Statamic\Eloquent\Auth\UserGroup::class,
],

];
34 changes: 34 additions & 0 deletions database/migrations/2021_05_18_160811_create_taxonomies_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTaxonomiesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('taxonomies', function (Blueprint $table) {
$table->increments('id');
$table->string('handle');
$table->string('title');
$table->json('sites')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('taxonomies');
}
}
36 changes: 36 additions & 0 deletions database/migrations/2021_05_19_082853_create_terms_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTermsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('taxonomy_terms', function (Blueprint $table) {
$table->id();
$table->string('site');
$table->string('slug');
$table->string('uri')->nullable();
$table->string('taxonomy');
$table->json('data');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('taxonomy_terms');
}
}
34 changes: 34 additions & 0 deletions database/migrations/2021_05_19_122354_create_globals_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGlobalsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('global_sets', function (Blueprint $table) {
$table->id();
$table->string('handle');
$table->string('title');
$table->json('localizations');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('global_sets');
}
}
37 changes: 37 additions & 0 deletions database/migrations/2021_05_19_143631_create_navigations_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNavigationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('navigations', function (Blueprint $table) {
$table->id();
$table->string('handle');
$table->string('title');
$table->json('collections')->nullable();
$table->integer('maxDepth')->nullable();
$table->boolean('expectsRoot')->default(false);
$table->string('initialPath')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('navigations');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateNavigationTreesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('trees', function (Blueprint $table) {
$table->id();
$table->string('handle');
$table->string('type');
$table->string('initialPath')->nullable();
$table->string('locale')->nullable();
$table->json('tree')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('trees');
}
}
49 changes: 49 additions & 0 deletions database/migrations/2021_05_28_114212_create_collections_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCollectionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('collections', function (Blueprint $table) {
$table->id();
$table->string('handle');
$table->string('title');
$table->json('routes')->nullable();
$table->boolean('dated')->default(false);
$table->string('past_date_behavior')->nullable();
$table->string('future_date_behavior')->nullable();
$table->boolean('default_publish_state')->default(true);
$table->boolean('ampable')->default(false);
$table->json('sites')->nullable();
$table->string('template')->nullable();
$table->string('layout')->nullable();
$table->string('sort_dir')->nullable();
$table->string('sort_field')->nullable();
$table->string('mount')->nullable();
$table->json('taxonomies')->nullable();
$table->boolean('revisions')->default(false);
$table->json('inject')->nullable();
$table->json('structure')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('collections');
}
}
34 changes: 34 additions & 0 deletions database/migrations/2021_09_26_213111_create_blueprints_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBlueprintsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('blueprints', function (Blueprint $table) {
$table->id();
$table->string('namespace')->nullable()->default(null);
$table->string('handle');
$table->json('data');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('blueprints');
}
}
33 changes: 33 additions & 0 deletions database/migrations/2021_09_26_214356_create_fieldsets_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateFieldsetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('fieldsets', function (Blueprint $table) {
$table->id();
$table->string('handle');
$table->json('data');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('fieldsets');
}
}
Loading