On Windows, we can get a path with \ directory separators. When we replace / with . in the blueprint's namespace, on Windows you can end up with a namespace in the database that looks something like:
This PR allows for this by extending Core's Blueprint to adjust the namespace if it starts with the mangled resource directory. This will allow users who already have data imported on a Windows system to be able to export that data using the existing command:
php please eloquent:export-blueprints
Correcting Blueprint Namespaces
For Windows users who already have impacted Blueprint namespaces and would like to fix their namespaces and continue using the Eloquent driver, they can execute this:
Important Note: Users who update to this PR, who do not update their existing blueprint namespaces and then re-import them will end up with extra records in their blueprints table (one record with the mangled namespace, and one record with the correct namespace).
This PR fixes #350. This issue is ultimately caused by this line:
https://github.com/statamic/eloquent-driver/blob/master/src/Commands/ImportBlueprints.php#L132
On Windows, we can get a path with
\
directory separators. When we replace/
with.
in the blueprint's namespace, on Windows you can end up with a namespace in the database that looks something like:When exporting, this will result in a duplicated path (since we replace the
.
with/
, and then append that to the blueprints directory).This PR fixes that by normalizing the blueprint path before importing.
Exporting Existing Blueprints w/ Impacted Namespaces
This PR allows for this by extending Core's Blueprint to adjust the namespace if it starts with the mangled resource directory. This will allow users who already have data imported on a Windows system to be able to export that data using the existing command:
Correcting Blueprint Namespaces
For Windows users who already have impacted Blueprint namespaces and would like to fix their namespaces and continue using the Eloquent driver, they can execute this:
Important Note: Users who update to this PR, who do not update their existing blueprint namespaces and then re-import them will end up with extra records in their blueprints table (one record with the mangled namespace, and one record with the correct namespace).