diff --git a/src/ORM/DataObjectSchema.php b/src/ORM/DataObjectSchema.php index a5477d098..b7d8132ed 100644 --- a/src/ORM/DataObjectSchema.php +++ b/src/ORM/DataObjectSchema.php @@ -24,12 +24,10 @@ class DataObjectSchema * Default separate for table namespaces. Can be set to any string for * databases that do not support some characters. * - * Defaults to \ to to conform to 3.x convention. - * * @config * @var string */ - private static $table_namespace_separator = '\\'; + private static $table_namespace_separator = '_'; /** * Cache of database fields diff --git a/tests/php/ORM/DataObjectSchemaTest.php b/tests/php/ORM/DataObjectSchemaTest.php index 034e61898..531b77f9d 100644 --- a/tests/php/ORM/DataObjectSchemaTest.php +++ b/tests/php/ORM/DataObjectSchemaTest.php @@ -9,6 +9,7 @@ use SilverStripe\ORM\DataObjectSchema; use SilverStripe\ORM\Tests\DataObjectSchemaTest\BaseClass; use SilverStripe\ORM\Tests\DataObjectSchemaTest\BaseDataClass; use SilverStripe\ORM\Tests\DataObjectSchemaTest\ChildClass; +use SilverStripe\ORM\Tests\DataObjectSchemaTest\DefaultTableName; use SilverStripe\ORM\Tests\DataObjectSchemaTest\GrandChildClass; use SilverStripe\ORM\Tests\DataObjectSchemaTest\HasFields; use SilverStripe\ORM\Tests\DataObjectSchemaTest\NoFields; @@ -31,7 +32,8 @@ class DataObjectSchemaTest extends SapphireTest HasFields::Class, NoFields::class, WithCustomTable::class, - WithRelation::class + WithRelation::class, + DefaultTableName::class ); /** @@ -49,6 +51,11 @@ class DataObjectSchemaTest extends SapphireTest 'DOSTWithCustomTable', $schema->tableName(WithCustomTable::class) ); + // Default table name is FQN + $this->assertEquals( + 'SilverStripe_ORM_Tests_DataObjectSchemaTest_DefaultTableName', + $schema->tableName(DefaultTableName::class) + ); } /** diff --git a/tests/php/ORM/DataObjectSchemaTest/DefaultTableName.php b/tests/php/ORM/DataObjectSchemaTest/DefaultTableName.php new file mode 100644 index 000000000..9284b9b15 --- /dev/null +++ b/tests/php/ORM/DataObjectSchemaTest/DefaultTableName.php @@ -0,0 +1,14 @@ + 'Varchar', + ]; +}