-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
language: docu: documentation for the migrate command of damlc #2579
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks a lot.
I'd prefer if @bame-da and/or someone from the DAML Seals has a look as well before we merge this since I'm too deep in the details already.
docs/source/migrate/index.rst
Outdated
|
||
Available options: | ||
TARGET_PATH Path where the new project should be located | ||
SOURCE Path to the main source file ('source' entry of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't we determine this from the manifest in the DAR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be possible, I'll try to change it.
|
||
.. code-block:: shell | ||
|
||
./build.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does daml migrate
generate build.sh
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no :P. I just tried it out and got the .daml
files, but no build scripts.
|
||
./build.sh | ||
|
||
respectively ``.\build.cmd`` if your on a Windows system. Note that you can **not** use the usual |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does daml build
not work? Can you please give a short explanation? Can we maybe actually make it work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
daml build
will initialize the package db from the given .dar dependencies. However, we want to generate the interface files from the .dars and put those into the package db. This is done during the migrate
command. If you call daml build
you will overwrite them again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean daml build
will bork the migration project? If so, we should fix that.
docs/source/migrate/index.rst
Outdated
|
||
where the ``Foo.daml`` file contains | ||
|
||
.. code-block:: daml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should put this in a separate file and use an include directive. I'm afraid the code will stop working at some point otherwise. Same below.
docs/source/migrate/index.rst
Outdated
with | ||
inC : ContractId A.Foo | ||
sigs : [Party] | ||
controller sigs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As soon as sigs
contains more than one party calling this choice needs another template to collect the signatures. We should generate that one as well. We should also base as much of this as possible on generic templates in the near future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed on the generic templates. I think we need some input anyways on how these upgrade templates should look like and what authorization they should have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we should include a workflow to collect signatures, either via generic templates, or by generating an UpgradeAgreement
template, which collects signatures and has non-consuming choices for op
to create and trigger Upgrade
on any of the generated templates.
conv : (Generic a repA, Generic b repB, Conv repA repB) => a -> b | ||
|
||
From its type signature you can see that it can convert any two data types that are instances of the | ||
``Generic`` class and whose generic representation can be converted itself. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need an explanation aiming at our users intuition here.
docs/source/migrate/index.rst
Outdated
two packages. In our example, you'll find them in the files ``FooAInstances.daml`` and | ||
``FooBInstances.daml``. | ||
|
||
Generic representations can be converted when they are ``isomorphic``. That means the corresponding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there are function called isomorphic
? If not, we should change the formatting from code-like to italic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
docs/source/migrate/index.rst
Outdated
|
||
The important hint is that the compiler is not able to deduce that our data type is an instance of | ||
the ``DA.Upgrade.Conv`` class and hence not convertible. In this case you will have to add your own | ||
upgrade/rollback templates to ``daml/Foo.daml``, that describe how to convert a contract of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
daml/Foo.daml` from which package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of the migration project you're building. I'll add it.
docs/source/migrate/index.rst
Outdated
You find more information on how to deploy DAML archive packages :ref:`here <deploy-ref_index>` . | ||
After the ``foo-upgrade-2.0.0`` package has been deployed on the ledger, there exists for every | ||
contract defined in ``foo-1.0.0`` a DAML workflow with a choice to upgrade it to ``foo-2.0.0`` or | ||
roll it back. A future iteration might add DAML triggers to carry out the upgrade process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's please remove the last sentence. I can be misread as a promise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these docs are good. I could follow them very easily, except that there was no mention that TARGET_PATH
has to be outside your project.
I also couldn't try it out as I got no build scripts.
|
||
.. code-block:: shell | ||
|
||
./build.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no :P. I just tried it out and got the .daml
files, but no build scripts.
|
||
./build.sh | ||
|
||
respectively ``.\build.cmd`` if your on a Windows system. Note that you can **not** use the usual |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean daml build
will bork the migration project? If so, we should fix that.
docs/source/migrate/index.rst
Outdated
with | ||
inC : ContractId A.Foo | ||
sigs : [Party] | ||
controller sigs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we should include a workflow to collect signatures, either via generic templates, or by generating an UpgradeAgreement
template, which collects signatures and has non-consuming choices for op
to create and trigger Upgrade
on any of the generated templates.
data Maybe a = Just a | Nothing | ||
|
||
When the package ``foo-2.0.0`` contains an extended data type of the ``Foo`` template that is not | ||
isomorphic, the build will fail. For example, let's assume the ``Foo`` module in the ``foo-2.0.0`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be much nicer if it went through with as much as possible, but left stubs for Conv
instances that it can't automatically derive. So the user can open Main.daml
and fill in those cv
definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will add the templates, but it won't compile so you really just have to change the line containing the application of the conv
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a sentence to the docs.
@bame-da said there are plenty of "unused import" warnings. We can suppress them with
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this and keep improving in incremental steps.
This adds a section on how to migrate between two different versions of two packages.
@bame-da ah, to follow this one of the PR's still needs to go to master |
This adds a chapter on how to migrate between two different versions of
two packages.
Pull Request Checklist
NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with
/AzurePipelines run
totrigger the build.